import { request } from '@/api/service'
import { method } from 'lodash'
export const urlPrefix = '/api/dataStatistics/'
import setting from '@/setting.js';
// 访问urlPrefix_local常量
const urlPrefix_local = setting.urlPrefix_local;

/**
 * 列表查询
 */
export function defectDataGetList(query) {
    // query.page = 3
    // query.limit = 999
    return request({
        url: urlPrefix + 'defectForm',
        method: 'get',
        params: query
    })
}
export function defectDataFilterGetList(query) {
    // query.page = 3
    // query.limit = 999
    return request({
        url: urlPrefix + 'defectDataFilter',
        method: 'get',
        params: query
    })
}
export function defectDataBatchFilterGetList(query) {
    // query.page = 3
    // query.limit = 999
    return request({
        url: urlPrefix + 'defectDataBatchFilter',
        method: 'get',
        params: query
    })
}
//地图
export function defectMapFilter(query) {
    // query.page = 3
    // query.limit = 999
    return request({
        url: urlPrefix + 'defectMapFilter',
        method: 'get',
        params: query
    })
}

export function defectBatchAndReel(query) {
    // query.page = 3
    // query.limit = 999
    return request({
        url: urlPrefix + 'defectBatchAndReel',
        method: 'get',
        params: query
    })
}

/**
 * 修改
 */
export function UpdateDefectData(obj) {
    return request({
        url: urlPrefix + "defectForm/" + obj.id + '/',
        method: 'put',
        data: obj
    })
}


/**
 * 删除
 */
export function DelDefectData(id) {
    return request({
        url: urlPrefix + 'defectForm/' + id + '/',
        method: 'delete',
        data: { id }
    })
}

/**
 * 新增
 */
export function createDefectData(obj) {
    return request({
        url: urlPrefix + "defectForm/",
        method: 'post',
        data: obj
    })
}

/**
 * 最新瑕疵信息
 */
export function defectLatest(query){
    return request({
        url: urlPrefix + 'defectLatest',
        method: 'get',
        params: query
    })
}

/**
 * 所有订单号和卷号查询
 */
export function defectallBatchReel(query){
    return request({
        url: urlPrefix + 'defectallBatchReel',
        method: 'get',
        params: query
    })
}

/**
 * 拼接图片url
 */
export function defectImageUrl(str){
    return urlPrefix_local + 'defectGetImageByName?imgPath=' + str
}
